/**
 *                            License
 * THE WORK (AS DEFINED BELOW) IS PROVIDED UNDER THE TERMS OF THIS  
 * CREATIVE COMMONS PUBLIC LICENSE ("CCPL" OR "LICENSE"). 
 * THE WORK IS PROTECTED BY COPYRIGHT AND/OR OTHER APPLICABLE LAW.  
 * ANY USE OF THE WORK OTHER THAN AS AUTHORIZED UNDER THIS LICENSE OR  
 * COPYRIGHT LAW IS PROHIBITED.
 * 
 * BY EXERCISING ANY RIGHTS TO THE WORK PROVIDED HERE, YOU ACCEPT AND  
 * AGREE TO BE BOUND BY THE TERMS OF THIS LICENSE. TO THE EXTENT THIS LICENSE  
 * MAY BE CONSIDERED TO BE A CONTRACT,
 * THE LICENSOR GRANTS YOU THE RIGHTS CONTAINED 
 * HERE IN CONSIDERATION OF YOUR ACCEPTANCE OF SUCH TERMS AND CONDITIONS.
 * 
 */
package com.lineage.server.model.skill;

import static com.lineage.server.model.skill.L1SkillId.*;

import com.lineage.server.datatables.SkillsTable;
import com.lineage.server.model.L1Character;
import com.lineage.server.model.L1EffectSpawn;
import com.lineage.server.model.Instance.L1MonsterInstance;
import com.lineage.server.model.Instance.L1NpcInstance;
import com.lineage.server.model.Instance.L1PcInstance;
import com.lineage.server.model.Instance.L1PetInstance;
import com.lineage.server.model.Instance.L1SummonInstance;
import com.lineage.server.packetserver.S_HPUpdate;
import com.lineage.server.packetserver.S_Liquor;
import com.lineage.server.packetserver.S_MPUpdate;
import com.lineage.server.packetserver.S_OwnCharAttrDef;
import com.lineage.server.packetserver.S_OwnCharStatus;
import com.lineage.server.packetserver.S_PacketBox;
import com.lineage.server.packetserver.S_Paralysis;
import com.lineage.server.packetserver.S_Poison;
import com.lineage.server.packetserver.S_SPMR;
import com.lineage.server.packetserver.S_ServerMessage;
import com.lineage.server.packetserver.S_SkillBrave;
import com.lineage.server.packetserver.S_SkillHaste;
import com.lineage.server.packetserver.S_SkillIconAura;
import com.lineage.server.packetserver.S_SkillIconBlessOfEva;
import com.lineage.server.packetserver.S_SkillIconBloodstain;
import com.lineage.server.packetserver.S_SkillIconWisdomPotion;
import com.lineage.server.packetserver.S_SkillSound;
import com.lineage.server.templates.L1Skills;

/**
 * Class <code>L1SkillStop</code> 技能停止判断.
 * 
 * @author jrwz
 * @version 2012-7-8下午04:27:09
 * @see com.lineage.server.model.skill
 * @since JDK1.7
 */
public final class L1SkillStop {

    /** 实例. */
    private static L1SkillStop instance;

    /**
     * 执行.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    public static void execute(final L1Character cha, final int skillId) {
        final L1Skills l1skills = SkillsTable.getInstance()
                .getTemplate(skillId);
        if (l1skills != null) {
            final int level = l1skills.getSkillLevel(); // 技能等级
            if ((level >= 1) && (level <= 10)) {
                skillStopWizard(cha, skillId); // 法师技能
            } else if ((level >= 11) && (level <= 12)) {
                skillStopKnight(cha, skillId); // 骑士技能
            } else if ((level >= 13) && (level <= 14)) {
                skillStopDarkElf(cha, skillId); // 黑暗精灵技能
            } else if (level == 15) {
                skillStopRoyal(cha, skillId); // 王族技能
            } else if ((level >= 17) && (level <= 22)) {
                skillStopElf(cha, skillId); // 精灵技能
            } else if ((level >= 23) && (level <= 25)) {
                skillStopDragonKnight(cha, skillId); // 龙骑士技能
            } else if ((level >= 26) && (level <= 28)) {
                skillStopIllusionist(cha, skillId); // 幻术师技能
            }
        } else {
            skillStopPotion(cha, skillId); // 药水类
            skillStopOther(cha, skillId); // 其他类
            skillStopCooking(cha, skillId); // 料理类
            skillStopArmor(cha, skillId); // 装备类
        }

        if (cha instanceof L1PcInstance) {
            final L1PcInstance pc = (L1PcInstance) cha;
            skillStopMessage(pc, skillId);
            pc.sendPackets(new S_OwnCharStatus(pc)); // 更新角色属性与能力值
        }
    }

    /**
     * 取得实例(当第一次为空时才新建一个).
     * 
     * @return 实例
     */
    public static L1SkillStop get() {
        if (instance == null) {
            instance = new L1SkillStop();
        }
        return instance;
    }

    /**
     * 装备类.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopArmor(final L1Character cha, final int skillId) {
        switch (skillId) {
            case EFFECT_OF_ARMOR_SETS: // 套装效果:动画
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    final int effect = pc.getGfxEffect();
                    if (effect > 0) {
                        final S_SkillSound sound = new S_SkillSound(pc.getId(),
                                effect);
                        pc.sendPackets(sound);
                        if (!pc.isInvisble()) {
                            pc.broadcastPacket(sound);
                        }
                        final int effectTime = pc.getGfxEffectTime();
                        // 倒计时时间(秒)
                        pc.setSkillEffect(EFFECT_OF_ARMOR_SETS, effectTime);
                    }
                }
                break;
            case EFFECT_OF_ARMOR: // 防具效果:动画
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    final int effect = pc.getGfxEffectOfArmor();
                    if (effect > 0) {
                        final S_SkillSound sound = new S_SkillSound(pc.getId(),
                                effect);
                        pc.sendPackets(sound);
                        if (!pc.isInvisble()) {
                            pc.broadcastPacket(sound);
                        }
                        final int effectTime = pc.getGfxEffectTimeOfArmor();
                        // 倒计时时间(秒)
                        pc.setSkillEffect(EFFECT_OF_ARMOR, effectTime);
                    }
                }
                break;
            case EFFECT_ITEM_OF_ARMOR_SETS: // 套装效果:获得特定道具
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    final int obtainProps = pc.getObtainProps(); // 要获得的道具
                    if (obtainProps > 0) {
                        pc.createNewItem(pc, obtainProps, 1); // 给予道具
                        // 倒计时时间(秒)
                        final int effectTime = pc.getObtainPropsTime();
                        pc.setSkillEffect(EFFECT_ITEM_OF_ARMOR_SETS, effectTime);
                    }
                }
                break;
            case EFFECT_ITEM_OF_ARMOR: // 防具效果:获得特定道具
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    final int obtainProps = pc.getObtainPropsArmor(); // 要获得的道具
                    if (obtainProps > 0) {
                        pc.createNewItem(pc, obtainProps, 1); // 给予道具
                        // 倒计时时间(秒)
                        final int effectTime = pc.getObtainPropsArmorTime();
                        pc.setSkillEffect(EFFECT_ITEM_OF_ARMOR, effectTime);
                    }
                }
                break;
            default:
                break;
        }
    }

    /**
     * 料理类.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopCooking(final L1Character cha,
            final int skillId) {
        switch (skillId) {
            case COOKING_1_0_N: // 漂浮之眼肉排
            case COOKING_1_0_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addWind(-10);
                    pc.addWater(-10);
                    pc.addFire(-10);
                    pc.addEarth(-10);
                    pc.sendPackets(new S_OwnCharAttrDef(pc));
                    pc.sendPackets(new S_PacketBox(53, 0, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_1_1_N: // 烤熊肉
            case COOKING_1_1_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-30);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.sendPackets(new S_PacketBox(53, 1, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_1_2_N: // 煎饼
            case COOKING_1_2_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 2, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_1_3_N: // 蚂蚁腿起司
            case COOKING_1_3_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addAc(1);
                    pc.sendPackets(new S_PacketBox(53, 3, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_1_4_N: // 水果沙拉
            case COOKING_1_4_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-20);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.sendPackets(new S_PacketBox(53, 4, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_1_5_N: // 水果糖醋肉
            case COOKING_1_5_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 5, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_1_6_N: // 烤山猪肉串
            case COOKING_1_6_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-5);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.sendPackets(new S_PacketBox(53, 6, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_1_7_N: // 蘑菇汤
            case COOKING_1_7_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 7, 0));
                    pc.setDessertId(0);
                }
                break;
            case COOKING_2_0_N: // 鱼子酱
            case COOKING_2_0_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 8, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_2_1_N: // 鳄鱼肉排
            case COOKING_2_1_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-30);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.addMaxMp(-30);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.sendPackets(new S_PacketBox(53, 9, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_2_2_N: // 龙龟蛋饼干
            case COOKING_2_2_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addAc(2);
                    pc.sendPackets(new S_PacketBox(53, 10, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_2_3_N: // 烤奇异鹦鹉
            case COOKING_2_3_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 11, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_2_4_N: // 毒蝎串烧
            case COOKING_2_4_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 12, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_2_5_N: // 烤伊莱克顿
            case COOKING_2_5_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-10);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.sendPackets(new S_PacketBox(53, 13, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_2_6_N: // 蜘蛛腿串烧
            case COOKING_2_6_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addSp(-1);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.sendPackets(new S_PacketBox(53, 14, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_2_7_N: // 蟹肉汤
            case COOKING_2_7_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 15, 0));
                    pc.setDessertId(0);
                }
                break;
            case COOKING_3_0_N: // 烤奎斯坦修的鳌
            case COOKING_3_0_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 16, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_3_1_N: // 烤格利芬肉
            case COOKING_3_1_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-50);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.addMaxMp(-50);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.sendPackets(new S_PacketBox(53, 17, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_3_2_N: // 亚力安的尾巴肉排
            case COOKING_3_2_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 18, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_3_3_N: // 烤巨王龟肉
            case COOKING_3_3_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addAc(3);
                    pc.sendPackets(new S_PacketBox(53, 19, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_3_4_N: // 幼龙翅膀串烧
            case COOKING_3_4_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-15);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.addWind(-10);
                    pc.addWater(-10);
                    pc.addFire(-10);
                    pc.addEarth(-10);
                    pc.sendPackets(new S_OwnCharAttrDef(pc));
                    pc.sendPackets(new S_PacketBox(53, 20, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_3_5_N: // 烤飞龙肉
            case COOKING_3_5_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addSp(-2);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.sendPackets(new S_PacketBox(53, 21, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_3_6_N: // 炖深海鱼肉
            case COOKING_3_6_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-30);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.sendPackets(new S_PacketBox(53, 22, 0));
                    pc.setCookingId(0);
                }
                break;
            case COOKING_3_7_N: // 邪恶蜥蜴蛋汤
            case COOKING_3_7_S:
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_PacketBox(53, 23, 0));
                    pc.setDessertId(0);
                }
                break;
            default:
                break;
        }
    }

    /**
     * 黑暗精灵技能.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopDarkElf(final L1Character cha,
            final int skillId) {
    }

    /**
     * 龙骑士技能.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopDragonKnight(final L1Character cha,
            final int skillId) {
        switch (skillId) {
            case FREEZING_BREATH: // 龙骑士魔法 (寒冰喷吐)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_Poison(pc.getId(), 0));
                    pc.broadcastPacket(new S_Poison(pc.getId(), 0));
                    pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_FREEZE,
                            false));
                } else if ((cha instanceof L1MonsterInstance)
                        || (cha instanceof L1SummonInstance)
                        || (cha instanceof L1PetInstance)) {
                    final L1NpcInstance npc = (L1NpcInstance) cha;
                    npc.broadcastPacket(new S_Poison(npc.getId(), 0));
                    npc.setParalyzed(false);
                }
                break;
            default:
                break;
        }
    }

    /**
     * 精灵技能.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopElf(final L1Character cha, final int skillId) {
        switch (skillId) {
            case ERASE_MAGIC: // 妖精魔法 (魔法消除)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_SkillIconAura(
                            S_SkillIconAura.ERASE_MAGIC, 0));
                }
                break;
            default:
                break;
        }
    }

    /**
     * 幻术师技能.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopIllusionist(final L1Character cha,
            final int skillId) {
        switch (skillId) {
            case BONE_BREAK_START: // 骷髅毁坏 (发动)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_STUN, true));
                    pc.setSkillEffect(BONE_BREAK_END, 1 * 1000);
                } else if ((cha instanceof L1MonsterInstance)
                        || (cha instanceof L1SummonInstance)
                        || (cha instanceof L1PetInstance)) {
                    final L1NpcInstance npc = (L1NpcInstance) cha;
                    npc.setParalyzed(true);
                    npc.setSkillEffect(BONE_BREAK_END, 1 * 1000);
                }
                break;
            case BONE_BREAK_END: // 骷髅毁坏 (结束)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_STUN, false));
                } else if ((cha instanceof L1MonsterInstance)
                        || (cha instanceof L1SummonInstance)
                        || (cha instanceof L1PetInstance)) {
                    final L1NpcInstance npc = (L1NpcInstance) cha;
                    npc.setParalyzed(false);
                }
                break;
            case STATUS_CUBE_IGNITION_TO_ALLY: // 立方:燃烧 (友方)
                cha.addFire(-30);
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_OwnCharAttrDef(pc));
                }
                break;
            case STATUS_CUBE_QUAKE_TO_ALLY: // 立方:地裂 (友方)
                cha.addEarth(-30);
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_OwnCharAttrDef(pc));
                }
                break;
            case STATUS_CUBE_SHOCK_TO_ALLY: // 立方:冲击 (友方)
                cha.addWind(-30);
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_OwnCharAttrDef(pc));
                }
                break;
            case STATUS_CUBE_IGNITION_TO_ENEMY: // 立方:燃烧 (敌方)
                // XXX
                break;
            case STATUS_CUBE_QUAKE_TO_ENEMY: // 立方:地裂 (敌方)
                // XXX
                break;
            case STATUS_CUBE_SHOCK_TO_ENEMY: // 立方:冲击 (敌方)
                // XXX
                break;
            case STATUS_MR_REDUCTION_BY_CUBE_SHOCK: // 由于 立方:冲击 (敌方)MR减少
                // cha.addMr(10);
                // if (cha instanceof L1PcInstance) {
                // L1PcInstance pc = (L1PcInstance) cha;
                // pc.sendPackets(new S_SPMR(pc));
                // }
                break;
            case STATUS_CUBE_BALANCE: // 立方:和谐
                // XXX
                break;
            default:
                break;
        }
    }

    /**
     * 骑士技能.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopKnight(final L1Character cha, final int skillId) {
    }

    /**
     * 发送技能停止信息.
     * 
     * @param charaPc
     *            - 角色
     * @param skillid
     *            - 技能ID
     */
    private static void skillStopMessage(final L1PcInstance charaPc,
            final int skillid) {
        final L1Skills l1skills = SkillsTable.getInstance()
                .getTemplate(skillid);
        // 无该技能、空角色
        if ((l1skills == null) || (charaPc == null)) {
            return;
        }

        final int msgID = l1skills.getSysmsgIdStop(); // 取回技能停止时要发送的信息
        if (msgID > 0) {
            charaPc.sendPackets(new S_ServerMessage(msgID));
        }
    }

    /**
     * 其他类.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopOther(final L1Character cha, final int skillId) {
        switch (skillId) {
            case EFFECT_MAGIC_STONE_A_1: // 附魔石1阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-10);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_A_2: // 附魔石2阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-20);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_A_3: // 附魔石3阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-30);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_A_4: // 附魔石4阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-40);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_A_5: // 附魔石5阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-50);
                    pc.addHpr(-1);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_A_6: // 附魔石6阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-60);
                    pc.addHpr(-2);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_A_7: // 附魔石7阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-70);
                    pc.addHpr(-3);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_A_8: // 附魔石8阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-80);
                    pc.addHpr(-4);
                    pc.addHitup(-1);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_A_9: // 附魔石9阶(近战)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-100);
                    pc.addHpr(-5);
                    pc.addHitup(-2);
                    pc.addDmgup(-2);
                    pc.addStr((byte) -1);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_1: // 附魔石1阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-5);
                    pc.addMaxMp(-3);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_2: // 附魔石2阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-10);
                    pc.addMaxMp(-6);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_3: // 附魔石3阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-15);
                    pc.addMaxMp(-10);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_4: // 附魔石4阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-20);
                    pc.addMaxMp(-15);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_5: // 附魔石5阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-25);
                    pc.addMaxMp(-20);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_6: // 附魔石6阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-30);
                    pc.addMaxMp(-20);
                    pc.addHpr(-1);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_7: // 附魔石7阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-35);
                    pc.addMaxMp(-20);
                    pc.addHpr(-1);
                    pc.addMpr(-1);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_8: // 附魔石8阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-40);
                    pc.addMaxMp(-25);
                    pc.addHpr(-2);
                    pc.addMpr(-1);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_B_9: // 附魔石9阶(远攻)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-50);
                    pc.addMaxMp(-30);
                    pc.addHpr(-2);
                    pc.addMpr(-2);
                    pc.addBowDmgup(-2);
                    pc.addBowHitup(-2);
                    pc.addDex((byte) -1);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_1: // 附魔石1阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-5);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_2: // 附魔石2阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-10);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_3: // 附魔石3阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-15);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_4: // 附魔石4阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-20);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_5: // 附魔石5阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-25);
                    pc.addMpr(-1);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_6: // 附魔石6阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-30);
                    pc.addMpr(-2);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_7: // 附魔石7阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-35);
                    pc.addMpr(-3);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_8: // 附魔石8阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-40);
                    pc.addMpr(-4);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_C_9: // 附魔石9阶(恢复)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-50);
                    pc.addMpr(-5);
                    pc.addInt((byte) -1);
                    pc.addSp(-1);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_1: // 附魔石1阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-2);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_2: // 附魔石2阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-4);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_3: // 附魔石3阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-6);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_4: // 附魔石4阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-8);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_5: // 附魔石5阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-10);
                    pc.addAc(1);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_6: // 附魔石6阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-10);
                    pc.addAc(2);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_7: // 附魔石7阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-10);
                    pc.addAc(3);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_8: // 附魔石8阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-15);
                    pc.addAc(4);
                    pc.addDamageReductionByArmor(-1);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_STONE_D_9: // 附魔石9阶(防御)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMr(-20);
                    pc.addAc(5);
                    pc.addCon((byte) -1);
                    pc.addDamageReductionByArmor(-3);
                    pc.sendPackets(new S_SPMR(pc));
                    pc.setMagicStoneLevel((byte) 0);
                }
                break;
            case EFFECT_MAGIC_EYE_OF_AHTHARTS: // 地龙之魔眼
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addRegistStone(-3); // 石化耐性
                    pc.addDodge((byte) -1); // 闪避率 - 10%
                    // 更新闪避率显示
                    pc.sendPackets(new S_PacketBox(88, pc.getDodge()));
                }
                break;
            case EFFECT_MAGIC_EYE_OF_FAFURION: // 水龙之魔眼
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.add_regist_freeze(-3); // 寒冰耐性
                    // 魔法伤害减免
                }
                break;
            case EFFECT_MAGIC_EYE_OF_LINDVIOR: // 风龙之魔眼
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addRegistSleep(-3); // 睡眠耐性
                    // 魔法暴击率
                }
                break;
            case EFFECT_MAGIC_EYE_OF_VALAKAS: // 火龙之魔眼
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addRegistStun(-3); // 昏迷耐性
                    pc.addDmgup(-2); // 额外攻击点数
                }
                break;
            case EFFECT_MAGIC_EYE_OF_BIRTH: // 诞生之魔眼
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addRegistBlind(-3); // 闇黑耐性
                    // 魔法伤害减免
                    pc.addDodge((byte) -1); // 闪避率 - 10%
                    // 更新闪避率显示
                    pc.sendPackets(new S_PacketBox(88, pc.getDodge()));
                }
                break;
            case EFFECT_MAGIC_EYE_OF_FIGURE: // 形象之魔眼
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addRegistSustain(-3); // 支撑耐性
                    // 魔法伤害减免
                    // 魔法暴击率
                    pc.addDodge((byte) -1); // 闪避率 - 10%
                    // 更新闪避率显示
                    pc.sendPackets(new S_PacketBox(88, pc.getDodge()));
                }
                break;
            case EFFECT_MAGIC_EYE_OF_LIFE: // 生命之魔眼
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addDmgup(-2); // 额外攻击点数
                    // 魔法伤害减免
                    // 魔法暴击率
                    // 防护中毒状态
                    pc.addDodge((byte) -1); // 闪避率 - 10%
                    // 更新闪避率显示
                    pc.sendPackets(new S_PacketBox(88, pc.getDodge()));
                }
                break;
            case EFFECT_BLESS_OF_CRAY: // 卡瑞的祝福
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-100);
                    pc.addMaxMp(-50);
                    pc.addHpr(-3);
                    pc.addMpr(-3);
                    pc.addEarth(-30);
                    pc.addDmgup(-1);
                    pc.addHitup(-5);
                    pc.addWeightReduction(-40);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                }
                break;
            case EFFECT_BLESS_OF_SAELL: // 莎尔的祝福
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-80);
                    pc.addMaxMp(-10);
                    pc.addWater(-30);
                    pc.addAc(8);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                }
                break;
            case STATUS_CURSE_YAHEE: // 炎魔的烙印
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_SkillIconAura(
                            S_SkillIconAura.STATUS_CURSE_YAHEE, 0, 1));
                }
                break;
            case STATUS_CURSE_BARLOG: // 火焰之影的烙印
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_SkillIconAura(
                            S_SkillIconAura.STATUS_CURSE_BARLOG, 0, 2));
                }
                break;
            case ICE_LANCE_COCKATRICE: // 亚力安冰矛围篱
            case ICE_LANCE_BASILISK: // 邪恶蜥蜴冰矛围篱
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_Poison(pc.getId(), 0));
                    pc.broadcastPacket(new S_Poison(pc.getId(), 0));
                    pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_FREEZE,
                            false));
                } else if ((cha instanceof L1MonsterInstance)
                        || (cha instanceof L1SummonInstance)
                        || (cha instanceof L1PetInstance)) {
                    final L1NpcInstance npc = (L1NpcInstance) cha;
                    npc.broadcastPacket(new S_Poison(npc.getId(), 0));
                    npc.setParalyzed(false);
                }
                break;
            case THUNDER_GRAB_START: // 夺命之雷(发动)
                final L1Skills _skill = SkillsTable.getInstance().getTemplate(
                        THUNDER_GRAB); // 夺命之雷
                final int _fetterDuration = _skill.getBuffDuration() * 1000;
                cha.setSkillEffect(STATUS_FREEZE, _fetterDuration);
                L1EffectSpawn.getInstance().spawnEffect(81182, _fetterDuration,
                        cha.getX(), cha.getY(), cha.getMapId());
                break;
            case STATUS_FREEZE: // 束缚术
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_BIND, false));
                } else if ((cha instanceof L1MonsterInstance)
                        || (cha instanceof L1SummonInstance)
                        || (cha instanceof L1PetInstance)) {
                    final L1NpcInstance npc = (L1NpcInstance) cha;
                    npc.setParalyzed(false);
                }
                break;
            case STATUS_CHAT_PROHIBITED: // 禁言
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_ServerMessage(288)); // 你现在已经可以交谈了。
                }
                break;
            // ****** 毒关系
            case STATUS_POISON: // 毒伤害
                cha.curePoison();
                break;
            case COOKING_WONDER_DRUG: // 象牙塔妙药
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addHpr(-10);
                    pc.addMpr(-2);
                }
                break;
            case EFFECT_BLESS_OF_MAZU: // 妈祖的祝福
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addHitup(-3);
                    pc.addDmgup(-3);
                    pc.addMpr(-2);
                }
                break;
            case EFFECT_STRENGTHENING_HP: // 体力增强卷轴
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxHp(-50);
                    pc.addHpr(-4);
                    pc.sendPackets(new S_HPUpdate(pc.getCurrentHp(), pc
                            .getMaxHp()));
                    if (pc.isInParty()) { // 组队中
                        pc.getParty().updateMiniHP(pc);
                    }
                }
                break;
            case EFFECT_STRENGTHENING_MP: // 魔力增强卷轴
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addMaxMp(-40);
                    pc.addMpr(-4);
                    pc.sendPackets(new S_MPUpdate(pc.getCurrentMp(), pc
                            .getMaxMp()));
                }
                break;
            case EFFECT_ENCHANTING_BATTLE: // 强化战斗卷轴
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addHitup(-3);
                    pc.addDmgup(-3);
                    pc.addBowHitup(-3);
                    pc.addBowDmgup(-3);
                    pc.addSp(-3);
                    pc.sendPackets(new S_SPMR(pc));
                }
                break;
            case EFFECT_BLOODSTAIN_OF_ANTHARAS: // 安塔瑞斯的血痕
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addAc(2);
                    pc.addWater(-50);
                    pc.sendPackets(new S_SkillIconBloodstain(
                            S_SkillIconBloodstain.ANTHARAS, 0));
                }
                break;
            case EFFECT_BLOODSTAIN_OF_FAFURION: // 法利昂的血痕
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.addWind(-50);
                    pc.sendPackets(new S_SkillIconBloodstain(
                            S_SkillIconBloodstain.FAFURION, 0));
                }
                break;
            default:
                break;
        }
    }

    /**
     * 药水类.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopPotion(final L1Character cha, final int skillId) {
        switch (skillId) {
            case STATUS_HASTE: // 一段加速
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_SkillHaste(pc.getId(), 0, 0));
                    pc.broadcastPacket(new S_SkillHaste(pc.getId(), 0, 0));
                }
                cha.setMoveSpeed(0);
                break;
            case STATUS_BRAVE: // 二段加速
            case STATUS_ELFBRAVE:
            case STATUS_BRAVE2:
                cha.setBraveSpeed(0);
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_SkillBrave(pc.getId(), 0, 0));
                    pc.broadcastPacket(new S_SkillBrave(pc.getId(), 0, 0));
                }
                break;
            case STATUS_THIRD_SPEED: // 三段加速
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_Liquor(pc.getId(), 0)); // 人物 * 1.15
                    pc.broadcastPacket(new S_Liquor(pc.getId(), 0)); // 人物 *
                                                                     // 1.15
                }
                break;
            /** 生命之树果实 */
            // case STATUS_RIBRAVE: // 生命之树果实
            // XXX 生命之树果实状态消除方法不明 cha.setBraveSpeed(0);
            // break;
            case STATUS_BLUE_POTION: // 蓝色药水
                // XXX
                break;
            case STATUS_UNDERWATER_BREATH: // 人鱼之鳞与受祝福的伊娃之鳞
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_SkillIconBlessOfEva(pc.getId(), 0));
                }
                break;
            case STATUS_WISDOM_POTION: // 智慧药水
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    cha.addSp(-2);
                    pc.sendPackets(new S_SkillIconWisdomPotion(0));
                }
                break;
            default:
                break;
        }
    }

    /**
     * 王族技能.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopRoyal(final L1Character cha, final int skillId) {

    }

    /**
     * 法师技能.
     * 
     * @param cha
     *            - 对象
     * @param skillId
     *            - 技能编号
     */
    private static void skillStopWizard(final L1Character cha, final int skillId) {
        switch (skillId) {
            case ICE_LANCE: // 法师魔法 (冰矛围篱)
            case FREEZING_BLIZZARD: // 法师魔法 (冰雪飓风)
                if (cha instanceof L1PcInstance) {
                    final L1PcInstance pc = (L1PcInstance) cha;
                    pc.sendPackets(new S_Poison(pc.getId(), 0));
                    pc.broadcastPacket(new S_Poison(pc.getId(), 0));
                    pc.sendPackets(new S_Paralysis(S_Paralysis.TYPE_FREEZE,
                            false));
                } else if ((cha instanceof L1MonsterInstance)
                        || (cha instanceof L1SummonInstance)
                        || (cha instanceof L1PetInstance)) {
                    final L1NpcInstance npc = (L1NpcInstance) cha;
                    npc.broadcastPacket(new S_Poison(npc.getId(), 0));
                    npc.setParalyzed(false);
                }
                break;
            default:
                break;
        }
    }

    /** 技能停止判断. */
    private L1SkillStop() {
    }
}
